#ifndef REDISCLIENT_H
#define REDISCLIENT_H

#include <hiredis/hiredis.h>  
#include <string>  
#include <stdexcept>  
#include <memory>  
#include <iostream>
  
class RedisClient {  
public:  
    RedisClient(const std::string& host = "127.0.0.1", int port = 6379)  
        : host_(host), port_(port), context_(nullptr) {  
        connect();  
    }  
  
    ~RedisClient() {  
        disconnect();  
    }  
  
  
    // 发送
    std::string sendCommand(const std::string& command);
  
private:  
    void connect();
  
    void disconnect();
  
    std::string host_;  
    int port_;  
    redisContext* context_;  
};  
  

#endif